﻿
@{
    ViewData["Title"] = "编辑按钮";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
    var errmsg = TempData["errMsg"];
}
<div id="app" v-clock>
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" action="@Url.Action("Edit")" method="post" style="width: 60%;">
        @Html.AntiForgeryToken()
        <el-form-item label="中文名称" prop="ButtonName">
            <el-input v-model="ruleForm.ButtonName" size="small" class="col-6" name="ButtonName"></el-input>
        </el-form-item>
        <el-form-item label="Action" prop="ButtonTag">
            <el-input v-model="ruleForm.ButtonTag" size="small" class="col-6" name="ButtonTag"></el-input>
        </el-form-item> 
        <el-form-item label="序号" prop="ButtonNum">
            <el-input v-model.number="ruleForm.ButtonNum" size="small" class="col-6" name="ButtonNum"></el-input>
        </el-form-item>
        <el-form-item label="标题" prop="Titles">
            <el-input v-model="ruleForm.Titles" size="small" class="col-6" name="Titles"></el-input>
        </el-form-item>
        <el-form-item label="图标" prop="Icons">
            <el-input v-model="ruleForm.Icons" size="small" class="col-6" name="Icons"></el-input><i v-bind:class="ruleForm.Icons"></i>
        </el-form-item>
        <el-form-item label="说明" prop="Remarks">
            <el-input v-model="ruleForm.Remarks" size="small" class="col-6" name="Remarks"></el-input>
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @@click="submitForm('ruleForm')" size="small">保存</el-button>
            <el-button @@click="resetForm('ruleForm')" size="small">重置</el-button>
            <el-button icon="el-icon-back" size="small" @@click="funBack">返回 按钮管理</el-button>
        </el-form-item>
        <input type="hidden" v-model="ruleForm.Id" name="Id" />
        <input type="hidden" v-model="ruleForm.CreateAt" name="CreateAt" />
        <input type="hidden" v-model="ruleForm.CreateName" name="CreateName" />
        <input type="hidden" v-model="ruleForm.CreateId" name="CreateId" />
        <input type="hidden" v-model="ruleForm.UpdateAt" name="UpdateAt" />
        <input type="hidden" v-model="ruleForm.UpdateName" name="UpdateName" />
        <input type="hidden" v-model="ruleForm.UpdateId" name="UpdateId" />
        <input type="hidden" v-model="ruleForm.IsDel" name="IsDel" />
    </el-form>
</div>
@section Scripts
    {
    <script type="text/javascript">
        @if (errmsg!=null&&!string.IsNullOrEmpty(errmsg.ToString()))
        {
            //系统异常信息 输出
          @:$(function() { @(Html.Raw(errmsg)); });
        }

        new Vue({
            el: "#app",
            data:function () {
                return {
                    ruleForm: @Html.Raw(ViewBag.model),
                    rules: {
                        ButtonName: [
                            { required: true, message: '请输入按钮名称', trigger: 'blur' }
                        ],
                        ButtonTag: [
                            { required: true, message: '请输入标签', trigger: 'blur' }
                        ],
                        ButtonNum: [
                            { required: true, message: '请输入序号，不能重复', trigger: 'blur' }
                        ]
                    }
                };
            },
            methods: {
                submitForm: function(formName) {
                    this.$refs[formName].validate(function(valid) {
                        if (valid) {
                            $("form").eq(0).submit();
                        } else {
                            return false;
                        }
                    });
                },
                resetForm: function(formName) {
                    this.$refs[formName].resetFields();
                },
                funBack: function() {
                    window.history.go(-1);
                }
            }
        })
    </script>
}